package com.wolves.career.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.wolves.career.entity.JobOpportunityTechnology;
import com.wolves.career.mapper.JobOpportunityTechnologyMapper;
import com.wolves.career.service.JobOpportunityTechnologyService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.Date;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author 麦翔盛
 * @since 2021-10-23
 */
@Service
public class JobOpportunityTechnologyServiceImpl extends ServiceImpl<JobOpportunityTechnologyMapper, JobOpportunityTechnology> implements JobOpportunityTechnologyService {

    @Override
    public QueryWrapper<JobOpportunityTechnology> queryTechnology(JobOpportunityTechnology technology) {
        if (technology == null) {
            return null;
        }
        String name = technology.getName();
        Date createTime = technology.getCreateTime();
        Date updateTime = technology.getUpdateTime();
        QueryWrapper<JobOpportunityTechnology> queryWrapper = new QueryWrapper<>();
        if (!StringUtils.isEmpty(name)) {
            queryWrapper.like("name", name);
        }
        if (!StringUtils.isEmpty(createTime)) {
            queryWrapper.gt("create_time", createTime);
        }
        if (!StringUtils.isEmpty(updateTime)) {
            queryWrapper.lt("update_time", updateTime);
        }
        return queryWrapper;
    }
}
